package com.lintf.distributed.transaction.inventory;

import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

@Component
public class ConfigLoadListener implements ApplicationListener<ApplicationPreparedEvent> {
    @Override
    public void onApplicationEvent(ApplicationPreparedEvent event) {
        ConfigurableEnvironment env = event.getApplicationContext().getEnvironment();
        System.out.println("=== 加载的Nacos配置 ===");
        env.getPropertySources().forEach(ps -> {
            if (ps.getName().contains("nacos")) {
                System.out.println(ps.getName());
            }
        });
    }
}